/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package CCPVSimulationPackage;

import ccpv.Person;
import coalition.formation.UtilityProvider;
import coherence.CrossSectionToCoalition;
import coherence.CrossSectionToCoalitionInterface;
import function.ArslanConflictFunction;
import function.ConflictFunction;
import java.util.HashMap;
import java.util.List;
import multiarray.MultiArray;

/**
 *
 * @author Heather
 */
public class CCPVMediator implements UtilityProvider
{

  int[] dimensions;
  MultiArray<MultiArray<Float>> altruisms;
  MultiArray<Float> populationByCrossSection;
  MultiArray<Float> powerByCrossSection;
  // each cross section has a pi... need to loop through agents of roberts to get multiarray for leo
  ConflictFunction func;
  //MultiArray<Double> pies;

  public CCPVMediator(ConflictFunction func,
          MultiArray<MultiArray<Float>> altruisms,
          MultiArray<Float> populationByCrossSection,
          MultiArray<Float> powerByCrossSection)
  {
    this.func = func;
    this.altruisms = altruisms;
    this.populationByCrossSection = populationByCrossSection;
    this.powerByCrossSection = powerByCrossSection;
  }

  public float[] getUtilities(List<List<int[]>> partition)
  {
    CrossSectionToCoalitionInterface csInterface = CrossSectionToCoalition.getNewCrossSectionToCoalition(altruisms, partition, populationByCrossSection, powerByCrossSection);
    return func.getUtilities(partition, csInterface.getCoalitionalBetas());
  }

  public float[][] getCoalitionBetas(List<List<int[]>> partition)
  {
    CrossSectionToCoalitionInterface csInterface = CrossSectionToCoalition.getNewCrossSectionToCoalition(altruisms, partition, populationByCrossSection, powerByCrossSection);
    return csInterface.getCoalitionalBetas();
  }

  public MultiArray<MultiArray<Float>> getAltruisms()
  {
    return altruisms;
  }

  public MultiArray<Float> getPowerByCrossSection()
  {
    return powerByCrossSection;
  }

  public MultiArray<Float> getPopulationByCrossSection()
  {
    return populationByCrossSection;
  }

  public int[] getDimensions()
  {
    return dimensions;
  }

  public void setDimensions(int[] dimensions)
  {
    this.dimensions = dimensions;
  }
}
